import mockRequest from "@/utils/mockRequest";

const access_token = "439b9104-1848-477a-aad9-0902069119d6";

//视频列表类
export interface VideoModel {
  cover: string;
  duration: number;
  persistentId: string;
  size: number;
  originUrl: string;
  free: string;
  title: string;
  url: string;
  hlsUrl: string;
}

export interface MoreBackupModel {
  videoCount: number;
  totalDuration: number;
  videos: VideoModel[];
}

export interface MediaSummaryModel {
  duration: number;
  count: number;
}

export interface CreatorBackupModel {
  level: number;
  name: string;
  avatar: string;
  id: string;
  vipGrade: number;
  certificationType: string;
}

export interface StatisticsBackupModel {
  viewCount: number;
  praiseCount: number;
  favoriteCount: number;
}

export interface MomentClassificationBackupModel {
  workTitle: string;
  classification: string;
}

export interface ContentModel {
  enclosureCount: number;
  moreBackup: MoreBackupModel;
  notVipPromotion: number;
  subject: string;
  num: number;
  channel: string;
  cityId: string;
  title: string;
  cover: string[];
  router: string;
  mediaSummary: MediaSummaryModel;
  cityName: string;
  avocationTags: [];
  id: string;
  recDegree: number;
  creator: string;
  algorithmSortValue: number;
  aiyigeApplication: string;
  vipPromotion: number;
  creatorBackup: CreatorBackupModel;
  editHighestVersion: string;
  updateTime: number;
  version: number;
  tags: [];
  needPromotion: number;
  onsellUpdateTime: number;
  createTime: number;
  statisticsBackup: StatisticsBackupModel;
  initExposureNum: number;
  momentClassificationBackup: MomentClassificationBackupModel;
  status: number;
  onsellTime: number;
}

export interface VideoListModel {
  content: ContentModel[];
  first: boolean;
  last: boolean;
  number: number;
  numberOfElements: number;
  offset: null;
  size: 20;
  sort: null;
  statistics: null;
  totalElements: number;
  totalPages: number;
  useOffset: boolean;
}

//筛选类
export interface ScreenModel {
  name: string;
  id: string;
  isSelect: boolean;
}

export interface ProductionScreenModel {
  choises: ScreenModel[];
  formType: string;
  label: string;
  name: string;
  style: string;
  valueType: string;
}

export interface SearchModel {
  groupType: string;
  name: string;
  description: string;
  momentCount: number;
  id: string;
}

export interface VideoCreatorModel {
  accid: string;
  avatar: string;
  certificationType: string;
  id: string;
  level: number;
  mobile: null;
  name: string;
  recentSellerFavorableValue: number;
  recomFactor: null;
  recomFactorExpireTime: null;
  sellerFavorableValue: number;
  type: null;
  vipExpireTime: null;
  vipGrade: number;
}

export interface momentClassificationModel {
  originAuthor: string;
  originSource: string;
  workTitle: string;
  originalStatement: number;
  classification: string;
}

export interface recommendMineBackupModel {
  cover: string[];
  router: string;
  subject: string;
  statisticsBackup: {
    viewCount: number;
  };
  editHighestVersion: string;
  id: string;
  title: string;
  momentClassificationBackup: object;
}

export interface VideoPlayModel {
  addressChanged: boolean;
  addressConfirmRemind: boolean;
  aiyigeApplication: null;
  auditMsg: null;
  auditStatus: null;
  auditTime: null;
  auditor: null;
  auditorName: null;
  categoryId: null;
  channel: string;
  cityId: string;
  cityName: string;
  classification: string;
  commodityBackup: object;
  courseEnded: null;
  cover: string[];
  createTime: number;
  creator: string;
  creatorBackup: VideoCreatorModel;
  depositAmount: number;
  detailBackup: object;
  divisionBackup: null;
  editHighestVersion: null;
  enclosureCount: number;
  enclosures: [];
  esSyncStatus: null;
  esid: null;
  esidBackup: null;
  favorableValue: number;
  forceUpdate: number;
  freshnessDegree: null;
  hasLiveBroadcast: number;
  id: string;
  imageTitleBackup: null;
  initExposureNum: null;
  inventoryBackup: null;
  letBuy: null;
  likabilityDegree: null;
  liveBroadcast: null;
  liveBroadcastTitles: [];
  mediaSummary: object;
  mineBackup: object;
  momentClassificationBackup: object;
  moreBackup: object;
  recommendMineBackup: recommendMineBackupModel[];
  recommendOtherBackup: recommendMineBackupModel[];
  relevancyAvocations: string[];
  statisticsBackup:StatisticsBackupModel
  requireBackup: any[];
  summary:string
  title:string
  router: string;
  webUrl: string;
}

export default {
  getVideoList() {
    return mockRequest.get<any, VideoListModel>(
      `/moment/moments/rec/default?access_token=${access_token}&column=recommend&pageSize=20&pageNum=0&localCache=0`
    );
  },
  getProductionSynthesize(bili: string) {
    return mockRequest.get<any, VideoListModel>(
      `/moment/moments/collect/original/${bili}?access_token=${access_token}&column=original&pageSize=20&pageNum=0`
    );
  },
  getCourseSynthesize() {
    return mockRequest.get<any, VideoListModel>(
      `/moment/moments/frontDynamic/default?access_token=${access_token}&column=frontDynamic&pageSize=20`
    );
  },
  getDynamic() {
    return mockRequest.get<any, VideoListModel>(
      `/moment/moments/collect/course/integrated?access_token=${access_token}&column=course&pageSize=20&pageNum=0`
    );
  },
  getProductionScreen() {
    return mockRequest.get<any, ProductionScreenModel[]>(
      `/moment/moments/moment/properties/filter/original?access_token=${access_token}`
    );
  },
  getSearch() {
    return mockRequest.get<any, SearchModel[]>(
      `/avocation/avocations/search/findByName?access_token=439b9104-1848-477a-aad9-0902069119d6&name=1`
    );
  },
  //获取视频播放数据
  getVideoPlay() {
    return mockRequest.get<any, VideoPlayModel>(
      `/moment/moments/64ab2e1a863342438d898d45ee6033c4?access_token=439b9104-1848-477a-aad9-0902069119d6&source=recommend`
    );
  },
};
